package com.ionehe.group.common.wechat.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * Copyright (c) 2022 杭州铲子科技
 * Date: 2022/1/6
 * Time: 3:43 下午
 *
 * @author 2022年 <a href="mailto:a@ionehe.com">秀</a>
 * 【WechatConfig】
 */
@Configuration
@Slf4j
@Data
public class WechatConfig {
    @Value("${wechat.app-id:-1}")
    private String appID;
    @Value("${wechat.app-secret:-1}")
    private String appSecret;
    @Value("${wechat.api.jscode2session-url:https://api.weixin.qq.com/sns/jscode2session}")
    private String jsCode2sessionUrl;
    @Value("${wechat.api.getuserphonenumber-url:https://api.weixin.qq.com/wxa/business/getuserphonenumber}")
    private String getUserPhoneUrl;
    @Value("${wechat.api.token-url:https://api.weixin.qq.com/cgi-bin/token}")
    private String accessTokenUrl;
    @Value("${wechat.api.getwxacodeunlimit-url:https://api.weixin.qq.com/wxa/getwxacodeunlimit}")
    private String getWxCodeUnLimitUrl;
    @Value("${wechat.api.openid-url:https://api.weixin.qq.com/sns/jscode2session}")
    private String openidUrl;

    @PostConstruct
    public void init() {
        log.info("WechatConfig[]init[]success! appId:{}, appSecret:{}, accessTokenUrl:{}, getWxCodeUnLimitUrl:{}, openidUrl:{}",
                appID, appSecret, accessTokenUrl, getWxCodeUnLimitUrl, openidUrl);
    }
}
